//
//  CBGRepairVC1.m
//  chebabaGYS
//
//  Created by yisu on 15/12/25.
//  Copyright © 2015年 zhengminjie. All rights reserved.
//

#import "CBGRepairVC1.h"
#import "CBGXingXing.h"
#import "RatingBar.h"

@interface CBGRepairVC1 ()<RatingBarDelegate>{
    


    __weak IBOutlet UIImageView *touxiang;
    __weak IBOutlet UILabel *phoneLab;
    __weak IBOutlet UILabel *xxxdanLab;
    
    __weak IBOutlet UIImageView *oneStar;
    __weak IBOutlet UIImageView *twostar;
    __weak IBOutlet UIImageView *threeStar;
    __weak IBOutlet UIImageView *fourStar;
    __weak IBOutlet UIImageView *fiveStar;
    __weak IBOutlet UILabel *moneylab;      //维修费多少钱
    __weak IBOutlet UIView *pingjiayonghu_xian; //评价用户下面的线
    __weak IBOutlet UILabel *pingjiayonghu_; // 评价用户
    __weak IBOutlet UIImageView *poneStar; //评价的星星
    __weak IBOutlet UIImageView *ptwoStar;
    __weak IBOutlet UIImageView *pthreeStar;
    __weak IBOutlet UIImageView *pfourStar;
    __weak IBOutlet UIImageView *pfiveStar;
    __weak IBOutlet UILabel *pingjiamiaosu_; //评价描述的Label
    __weak IBOutlet UIButton *quedingtijiao;    //确定提交
    __weak IBOutlet UITextView *pingjiaContent; //评价的内容
    __weak IBOutlet UIView *xingxingView; // 评价星星的view
    

}


@property (nonatomic, strong)NSString *numberStar;
@property (nonatomic, strong)NSMutableArray *allStar;
@end

@implementation CBGRepairVC1

- (void)viewDidLoad {
    [super viewDidLoad];
    //_numberStar = @"2";
    [self markStarShine];
    [self makeStarHeardShine];
}



//使星星亮起来
- (void)markStarShine{

    CGFloat width = xingxingView.bounds.size.width / 2 + 30;
    CGFloat height = 40;
    
    CGFloat x = (xingxingView.bounds.size.width - width)*0.5;
    RatingBar *ratingBar = [[RatingBar alloc] initWithFrame:CGRectMake(x, 0, width, height)];
    [xingxingView addSubview:ratingBar];
    //是否是指示器
    ratingBar.isIndicator = NO;
    
    [ratingBar setImageDeselected:@"xzwxc_13" halfSelected:nil fullSelected:@"xzwxc_14" andDelegate:self];
    
}

#pragma mark - RatingBar delegate
- (void)ratingChanged:(float)newRating{
    self.numberStar = [NSString stringWithFormat:@"%.0f",newRating];
    NSLog(@"self.starScroe---------%@", self.numberStar);
}


//是头像的那里星星亮起来
- (void)makeStarHeardShine{

    switch ([self.numberStar integerValue]) {
        case 0:
            oneStar.image = [UIImage imageNamed:@"xzwxc_13"];
             twostar.image = [UIImage imageNamed:@"xzwxc_13"];
             threeStar.image = [UIImage imageNamed:@"xzwxc_13"];
             fourStar.image = [UIImage imageNamed:@"xzwxc_13"];
             fiveStar.image = [UIImage imageNamed:@"xzwxc_13"];
            break;
        case 1:
            oneStar.image = [UIImage imageNamed:@"xzwxc_14"];
            twostar.image = [UIImage imageNamed:@"xzwxc_13"];
            threeStar.image = [UIImage imageNamed:@"xzwxc_13"];
            fourStar.image = [UIImage imageNamed:@"xzwxc_13"];
            fiveStar.image = [UIImage imageNamed:@"xzwxc_13"];
            break;

        case 2:
            oneStar.image = [UIImage imageNamed:@"xzwxc_14"];
            twostar.image = [UIImage imageNamed:@"xzwxc_14"];
            threeStar.image = [UIImage imageNamed:@"xzwxc_13"];
            fourStar.image = [UIImage imageNamed:@"xzwxc_13"];
            fiveStar.image = [UIImage imageNamed:@"xzwxc_13"];
            break;

        case 3:
            oneStar.image = [UIImage imageNamed:@"xzwxc_14"];
            twostar.image = [UIImage imageNamed:@"xzwxc_14"];
            threeStar.image = [UIImage imageNamed:@"xzwxc_14"];
            fourStar.image = [UIImage imageNamed:@"xzwxc_13"];
            fiveStar.image = [UIImage imageNamed:@"xzwxc_13"];
        case 4:
            oneStar.image = [UIImage imageNamed:@"xzwxc_14"];
            twostar.image = [UIImage imageNamed:@"xzwxc_14"];
            threeStar.image = [UIImage imageNamed:@"xzwxc_14"];
            fourStar.image = [UIImage imageNamed:@"xzwxc_14"];
            fiveStar.image = [UIImage imageNamed:@"xzwxc_13"];
            break;
        case 5:
            oneStar.image = [UIImage imageNamed:@"xzwxc_14"];
            twostar.image = [UIImage imageNamed:@"xzwxc_14"];
            threeStar.image = [UIImage imageNamed:@"xzwxc_14"];
            fourStar.image = [UIImage imageNamed:@"xzwxc_14"];
            fiveStar.image = [UIImage imageNamed:@"xzwxc_15"];
            break;


    }
}

- (IBAction)buttonAction:(UIButton *)button {
    if (button.tag == 1) {
        NSLog(@"返回箭头");
        [self.navigationController popViewControllerAnimated:YES];
    }
    if (button.tag == 2) {
        NSLog(@"同车档案");
    }
    if (button.tag == 3) {
        NSLog(@"信息");
    }
    if (button.tag == 4) {
        NSLog(@"电话");
    }
    if (button.tag == 5) {
        NSLog(@"查看维修单");
    }
    if (button.tag == 6) {
        NSLog(@"确定提交");
    }
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
